package com.vivachek.protocol.utils

import java.text.SimpleDateFormat

/**
 * @Author: YCB
 * @Time: 2022/10/9 13:54:30
 * @Email: congbin.yuan@vivachek.com
 * @Description: 日期工具类
 */
object DateTimeUtil {

    private val sdf = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
    fun currentTime(format:String?=null):String{
        if (format.isNullOrBlank()){
            sdf.applyPattern("yyyy-MM-dd HH:mm:ss")
            return sdf.format(System.currentTimeMillis())
        }else{
            sdf.applyPattern(format)
            return sdf.format(System.currentTimeMillis())
        }
    }
}